package com.deepocean.service.impl;

import com.deepocean.dao.LinearScreenDao;
import com.deepocean.entity.LinearScreenCondition;
import com.deepocean.entity.LinearScreenEntity;
import com.deepocean.entity.LinearScreenInAndOut1Hour;
import com.deepocean.service.ILinearScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class LinearScreenServiceImpl implements ILinearScreenService {
    @Autowired
    private LinearScreenDao linearScreenDao;

    @Override
    public boolean add(LinearScreenEntity linearScreenEntity) {
        String id = UUID.randomUUID().toString().replaceAll("-", "");
        linearScreenEntity.setId(id);
        return linearScreenDao.add(linearScreenEntity);
    }

    @Override
    public LinearScreenInAndOut1Hour getInAndOutInHour(String deviceId) {
        return linearScreenDao.getInAndOutInHour(deviceId);
    }

    @Override
    public List<LinearScreenEntity> getLinearScreenByCondition(LinearScreenCondition linearScreenCondition) {
        return linearScreenDao.getLinearScreenByCondition(linearScreenCondition);
    }
}
